package com.display.elements
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.net.navigateToURL;
	import flash.net.URLRequest;
	
	public class IconElement extends MovieClip
	{
		private var _url:String;
		
		public function IconElement()
		{
			super();
		}
		public function setup($url):void
		{
			_url = $url;
			
			this.addEventListener(MouseEvent.CLICK, onIconClicked, false, 0, true);
			this.buttonMode = true;
		}
		
		private function onIconClicked(evt:MouseEvent):void 
		{
			trace("IconElement.onIconClicked :: _url = " + _url);
			var request:URLRequest = new URLRequest(_url);
			try {
				navigateToURL(request, '_blank');
			} catch (e:Error) {
				trace("IconElement.onIconClicked ERROR :: " + e.message);
			}
		}
	}
}